﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponFactory : IWeaponFactory {
    public Weapon CreateWeapon(WeaponType weaponType)
    {
        Weapon weapon = null;
        string weaponName = "";
        float atkRange = 0;
        float atk = 0;
        float atkPlusValue = 0;
        switch (weaponType)
        {
            case WeaponType.Gun:
                weaponName = "WeaponGun";
                atkRange = 2f;
                atk = 10f;
                atkPlusValue = 1f;
                break;
            case WeaponType.Rifle:
                atkRange = 2f;
                atk = 10f;
                atkPlusValue = 1f;
                weaponName = "WeaponRifle";
                break;
            case WeaponType.Rocket:
                atkRange = 2f;
                atk = 10f;
                atkPlusValue = 1f;
                weaponName = "Weapon";
                break;
            case WeaponType.NullWeapon:
                break;
        }
        GameObject go= FactoryManager.AssetFactory.LoadWeapon(weaponName);
        switch (weaponType)
        {
            case WeaponType.Gun:
                weapon = new Gun(go, atk, atkRange, atkPlusValue);
                break;
            case WeaponType.Rifle:
                weapon = new Rifle(go, atk, atkRange, atkPlusValue);
                break;
            case WeaponType.Rocket:
                weapon = new Rocket(go, atk, atkRange, atkPlusValue);
                break;
            case WeaponType.NullWeapon:
                break;
           
        }
        return weapon;
    }

    
}
